home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 2Window.cpt / 2Window.c next >
C/C++ Source or Header  |  1989-09-03  |  928b  |  50 lines

  1. #include <Global.h>
  2.  
  3. #define FIRSTID 1000
  4. #define SECONDID 1001
  5.  
  6. short updates;
  7.  
  8. main()
  9. {
  10.     void initialize(void);
  11.  
  12.     WindowPtr    firstWindow, secondWindow;
  13.     EventRecord    theEvent;
  14.     Str255        str;
  15.     Rect        showRect;
  16.  
  17.     initialize();
  18.     firstWindow = GetNewWindow(FIRSTID, NULL, -1);
  19.     SetPort(firstWindow);
  20.     MoveTo(20, 20);
  21.     DrawString("\pUpdate Events:");
  22.     SetRect(&showRect,120, 10, 170, 20);
  23.     secondWindow = GetNewWindow(SECONDID, NULL, -1);
  24.     while (true) {
  25.         if (GetNextEvent(everyEvent, &theEvent));
  26.             if (theEvent.what == updateEvt) {
  27.                 updates++;
  28.                 BeginUpdate(theEvent.message);
  29.                 EndUpdate(theEvent.message);
  30.             }
  31.             if (theEvent.what == keyDown)
  32.                 break;
  33.             NumToString(updates, &str);
  34.             EraseRect(&showRect);
  35.             MoveTo(120, 20);
  36.             DrawString(str);
  37.     }
  38. }
  39.  
  40. void initialize(void)
  41. {
  42.     InitGraf(&thePort);
  43.     InitFonts();
  44.     InitWindows();
  45.     InitMenus();
  46.     TEInit();
  47.     InitDialogs(0L);
  48.     InitCursor();
  49.     FlushEvents( everyEvent, 0 );
  50. }